//
//  KingPieceFactory.m
//  INFSWA02
//
//  Created by Justin van Grootveld on 9/27/11.
//  Copyright 2011 Pro4all. All rights reserved.
//

#import "KingPieceFactory.h"
#import "Piece.h"

#import "Gear.h"
#import "Crown.h"
#import "Breastplate.h"
#import "Legplates.h"
#import "Gaunlets.h"
#import "Greaves.h"
#import "Sword.h"

#import "Player.h"

@implementation KingPieceFactory

#define name @"King"
#define code @"K"

+ (Piece *)createPieceForPlayer:(Player *)player
{
    //basic piece
    Piece *piece = [[Piece alloc] initWithName:name 
                                        player:player 
               andBaseStatsPhysicalAttackPower:20 
                            magicalAttackPower:0 
                               physicalDefense:20 
                                magicalDefense:20 
                                  healthPoints:100 
                                         range:3 
                                      movement:2];
    
    if(player.identifier == 1) //player that starts at bottom-left
    {
        [piece setMoveDirection: TOP | LEFT | RIGHT];
        [piece setAttackDirection: TOP | LEFT | RIGHT];
    }
    else
    {
        [piece setMoveDirection: BOTTOM | LEFT | RIGHT];
        [piece setAttackDirection: BOTTOM | LEFT | RIGHT];
    }
    
    [piece setCode:code];
    
    //gear
    Gear *gear = [Crown new];
    
    gear = [[Breastplate alloc] initWithGear:gear];
    gear = [[Legplates alloc] initWithGear:gear];
    gear = [[Gaunlets alloc] initWithGear:gear];
    gear = [[Greaves alloc] initWithGear:gear];
    gear = [[Sword alloc] initWithGear:gear];
    
    [piece setGear:gear];
    
    return piece;
}

@end
